package edu.psu.collegerecommendationhelper.coreservlets;

//Use Static imports to have direct access to these methods
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;

//import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import org.junit.Before;
import org.junit.Test;

import edu.psu.collegerecommendationhelper.coreservlets.ModifyDemographicInfoBean;
import edu.psu.collegerecommendationhelper.database.GenericDatabase;
import edu.psu.collegerecommendationhelper.model.CollegeResult;
import edu.psu.collegerecommendationhelper.model.EducationInfo;
import edu.psu.collegerecommendationhelper.model.PreferenceInfo;
import edu.psu.collegerecommendationhelper.model.UserBean;
import edu.psu.collegerecommendationhelper.model.AccountInfo;
import edu.psu.collegerecommendationhelper.model.DemographicInfo;
import edu.psu.collegerecommendationhelper.model.EducationInfo;
import edu.psu.collegerecommendationhelper.model.PreferenceInfo;
import edu.psu.collegerecommendationhelper.model.CollegeResult;

public class ModifyDemographicInfoBeanTest {

   private ModifyDemographicInfoBean modDem;
   private GenericDatabase genDB;
   private UserBean user;

   private String entered_state;
   private byte entered_age;
   private String entered_sex;
   private String entered_race;
   private String entered_relative1;
   private String entered_college1;
   private String entered_relative2;
   private String entered_college2;
   private String entered_relative3;
   private String entered_college3;
   private String entered_relative4;
   private String entered_college4;
   private String entered_relative5;
   private String entered_college5;


   @Before
   public void setUp() throws Exception {
      
      modDem = new ModifyDemographicInfoBean();

      genDB = createNiceMock(GenericDatabase.class);

      AccountInfo accInfo = new AccountInfo();
      EducationInfo eduInfo = new EducationInfo();
      PreferenceInfo preInfo = new PreferenceInfo();
      CollegeResult resultList = new CollegeResult();

      DemographicInfo demInfo = new DemographicInfo();
      demInfo.setState("NJ");
      demInfo.setAge((byte)29);
      demInfo.setSex("MALE");
      demInfo.setRace("CAUCASIAN");

      user = new UserBean();
      user.setAccountInfo(accInfo);
      user.setDemographicInfo(demInfo);
      user.setEducationInfo(eduInfo);
      user.setPreferenceInfo(preInfo);
      user.setResultList(resultList);

      entered_state = "";
      entered_age = 0;
      entered_sex = "";
      entered_race = "";
      entered_relative1 = "";
      entered_college1 = "";
      entered_relative2 = "";
      entered_college2 = "";
      entered_relative3 = "";
      entered_college3 = "";
      entered_relative4 = "";
      entered_college4 = "";
      entered_relative5 = "";
      entered_college5 = "";

   }

   @Test
   public void testNoNewValuesEntered() {
      //Expected Results
      //expect(modDem.saveDemographicInfo()).andReturn(null);

      //Activate Mock
      replay(genDB);

      assertEquals("Expected to do something", null, modDem.saveDemographicInfo());

   }

   @Test
   public void testSameStateEntered() {
      //Setup
      entered_state = "NJ";

      //Activate Mock
      replay(genDB);

      assertEquals("Expected to do something", null, modDem.saveDemographicInfo());

   }

   @Test
   public void testDifferentStateEntered() {
      //Setup
      entered_state = "PA";

      //Activate Mock
      replay(genDB);

      assertEquals("Return is null", "ModifyInfoPage", modDem.saveDemographicInfo());

   }


}